.class public Lcom/zuimeia/sdk/download/providers/downloads/ZMDownloadCompleteReceiver;
.super Landroid/content/BroadcastReceiver;
.source "ZMDownloadCompleteReceiver.java"


# direct methods
.method public constructor <init>()V
    .registers 1

    .prologue
    .line 21
    invoke-direct {p0}, Landroid/content/BroadcastReceiver;-><init>()V

    return-void
.end method


# virtual methods
.method public onReceive(Landroid/content/Context;Landroid/content/Intent;)V
    .registers 25
    .param p1, "context"    # Landroid/content/Context;
    .param p2, "intent"    # Landroid/content/Intent;

    .prologue
    .line 24
    if-nez p2, :cond_3

    .line 76
    :cond_2
    :goto_2
    return-void

    .line 27
    :cond_3
    invoke-virtual/range {p2 .. p2}, Landroid/content/Intent;->getAction()Ljava/lang/String;

    move-result-object v10

    .line 28
    .local v10, "action":Ljava/lang/String;
    const-string v4, "android.intent.action.DOWNLOAD_COMPLETE"

    invoke-virtual {v10, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v4

    if-eqz v4, :cond_2

    .line 29
    const-string v4, "extra_download_id"

    const-wide/16 v20, 0x0

    move-object/from16 v0, p2

    move-wide/from16 v1, v20

    invoke-virtual {v0, v4, v1, v2}, Landroid/content/Intent;->getLongExtra(Ljava/lang/String;J)J

    move-result-wide v8

    .line 30
    .local v8, "downId":J
    new-instance v17, Lcom/zuimeia/sdk/download/providers/ZMDownloadManager$Query;

    invoke-direct/range {v17 .. v17}, Lcom/zuimeia/sdk/download/providers/ZMDownloadManager$Query;-><init>()V

    .line 31
    .local v17, "query":Lcom/zuimeia/sdk/download/providers/ZMDownloadManager$Query;
    const/4 v4, 0x1

    new-array v4, v4, [J

    const/4 v5, 0x0

    aput-wide v8, v4, v5

    move-object/from16 v0, v17

    invoke-virtual {v0, v4}, Lcom/zuimeia/sdk/download/providers/ZMDownloadManager$Query;->setFilterById([J)Lcom/zuimeia/sdk/download/providers/ZMDownloadManager$Query;

    .line 32
    new-instance v13, Lcom/zuimeia/sdk/download/providers/ZMDownloadManager;

    invoke-virtual/range {p1 .. p1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v4

    invoke-virtual/range {p1 .. p1}, Landroid/content/Context;->getPackageName()Ljava/lang/String;

    move-result-object v5

    move-object/from16 v0, p1

    invoke-direct {v13, v0, v4, v5}, Lcom/zuimeia/sdk/download/providers/ZMDownloadManager;-><init>(Landroid/content/Context;Landroid/content/ContentResolver;Ljava/lang/String;)V

    .line 33
    .local v13, "mDownloadManager":Lcom/zuimeia/sdk/download/providers/ZMDownloadManager;
    const/4 v11, 0x0

    .line 35
    .local v11, "c":Landroid/database/Cursor;
    :try_start_3b
    move-object/from16 v0, v17

    invoke-virtual {v13, v0}, Lcom/zuimeia/sdk/download/providers/ZMDownloadManager;->query(Lcom/zuimeia/sdk/download/providers/ZMDownloadManager$Query;)Landroid/database/Cursor;

    move-result-object v11

    .line 36
    if-eqz v11, :cond_b1

    invoke-interface {v11}, Landroid/database/Cursor;->moveToFirst()Z

    move-result v4

    if-eqz v4, :cond_b1

    .line 37
    const-string v4, "status"

    invoke-interface {v11, v4}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I

    move-result v4

    invoke-interface {v11, v4}, Landroid/database/Cursor;->getInt(I)I

    move-result v18

    .line 38
    .local v18, "status":I
    const-string v4, "local_uri"

    invoke-interface {v11, v4}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I

    move-result v4

    invoke-interface {v11, v4}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v6

    .line 39
    .local v6, "filePath":Ljava/lang/String;
    const-string v4, "primary_key"

    invoke-interface {v11, v4}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I

    move-result v4

    invoke-interface {v11, v4}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v16

    .line 40
    .local v16, "primaryKey":Ljava/lang/String;
    const-string v4, "other_key"

    invoke-interface {v11, v4}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I

    move-result v4

    invoke-interface {v11, v4}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v15

    .line 41
    .local v15, "otherKey":Ljava/lang/String;
    const-string v4, "is_need_post_data"

    invoke-interface {v11, v4}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I

    move-result v4

    invoke-interface {v11, v4}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v12

    .line 42
    .local v12, "isNeedPostData":Ljava/lang/String;
    const-string v4, "media_type"

    invoke-interface {v11, v4}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I

    move-result v4

    invoke-interface {v11, v4}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v14

    .line 43
    .local v14, "mediaType":Ljava/lang/String;
    const/16 v4, 0x8

    move/from16 v0, v18

    if-ne v0, v4, :cond_9a

    .line 44
    const-string v4, "true"

    invoke-virtual {v12, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v4

    if-eqz v4, :cond_9a

    .line 45
    move-object/from16 v0, p1

    move-object/from16 v1, v16

    invoke-static {v0, v1, v15}, Lcom/zuiapps/sdk/analytics/ZMMobDownloadedAgent;->onDownloadedEvent(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)V

    .line 48
    :cond_9a
    invoke-static {v6}, Lcom/zuimeia/sdk/download/utils/AppIOUtil;->isApkFile(Ljava/lang/String;)Z

    move-result v4

    if-eqz v4, :cond_a5

    .line 49
    move-object/from16 v0, p1

    invoke-static {v0, v6}, Lcom/zuimeia/sdk/download/utils/AppIOUtil;->installApk(Landroid/content/Context;Ljava/lang/String;)V

    .line 51
    :cond_a5
    new-instance v4, Lcom/zuimeia/sdk/download/providers/downloads/ZMDownloadCompleteReceiver$1;

    move-object/from16 v5, p0

    move-object/from16 v7, p1

    invoke-direct/range {v4 .. v9}, Lcom/zuimeia/sdk/download/providers/downloads/ZMDownloadCompleteReceiver$1;-><init>(Lcom/zuimeia/sdk/download/providers/downloads/ZMDownloadCompleteReceiver;Ljava/lang/String;Landroid/content/Context;J)V

    .line 65
    invoke-virtual {v4}, Lcom/zuimeia/sdk/download/providers/downloads/ZMDownloadCompleteReceiver$1;->start()V
    :try_end_b1
    .catch Ljava/lang/Throwable; {:try_start_3b .. :try_end_b1} :catch_b8
    .catchall {:try_start_3b .. :try_end_b1} :catchall_c0

    .line 71
    .end local v6    # "filePath":Ljava/lang/String;
    .end local v12    # "isNeedPostData":Ljava/lang/String;
    .end local v14    # "mediaType":Ljava/lang/String;
    .end local v15    # "otherKey":Ljava/lang/String;
    .end local v16    # "primaryKey":Ljava/lang/String;
    .end local v18    # "status":I
    :cond_b1
    if-eqz v11, :cond_2

    .line 72
    invoke-interface {v11}, Landroid/database/Cursor;->close()V

    goto/16 :goto_2

    .line 68
    :catch_b8
    move-exception v4

    .line 71
    if-eqz v11, :cond_2

    .line 72
    invoke-interface {v11}, Landroid/database/Cursor;->close()V

    goto/16 :goto_2

    .line 71
    :catchall_c0
    move-exception v4

    if-eqz v11, :cond_c6

    .line 72
    invoke-interface {v11}, Landroid/database/Cursor;->close()V

    :cond_c6
    throw v4
.end method
